<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="mode" />
        <title>${Inter.printOut('Create Employee',session.language)}</title>
    </head>
    <body>
      <!--this code for putting budget mode-->
             <!-- <g:btnMode mode="${session.mode}"  currentController="employee" currentView="create"></g:btnMode> -->
        <div class="body">

            <div class="undernav">
            <!-- This is the help button. -->
            <%  def help = Help.findByNameAndLanguage("employee_create", session.language)
            def helplink = createLink(action:'show', controller:'help', id: help.id )%>
            <a href="#" onClick="MyWindow=window.open('${helplink}','Help','width=350,height=450'); return false;">${Inter.printOut('Help',session.language)}</a>
            <!-- This is the end of the help button. -->
            </div>

          

            <h1>
${Inter.printOut('Create Employee',session.language)}
             </h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${employeeInstance}">
            <div class="errors">
                <g:renderErrors bean="${employeeInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" method="post" >
                <div class="dialog">
                    <table>
                        <tbody>
                          <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="employeeId">
                                      ${Inter.printOut('Employee Id:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'employeeId','errors')}">
                                    <input type="text" id="employeeId" maxlength="6" size="6" name="employeeId" title="${Inter.printOut('employee_employeeId_hover',session.language)}" value="${fieldValue(bean:employeeInstance,field:'employeeId')}" />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="firstName">
                                    ${Inter.printOut('First Name:',session.language)}
                                  </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'firstName','errors')}">
                                    <input type="text" maxlength="20" id="firstName" name="firstName" value="${fieldValue(bean:employeeInstance,field:'firstName')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="lastName">
                                      ${Inter.printOut('Last Name:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'lastName','errors')}">
                                    <input type="text" maxlength="20" id="lastName" name="lastName" value="${fieldValue(bean:employeeInstance,field:'lastName')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="street">
                                      ${Inter.printOut('Street:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'street','errors')}">
                                    <input type="text" maxlength="20" id="street" name="street" value="${fieldValue(bean:employeeInstance,field:'street')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="city">
                                      ${Inter.printOut('City:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'city','errors')}">
                                    <input type="text" maxlength="20" id="city" name="city" value="${fieldValue(bean:employeeInstance,field:'city')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="zipCode">
                                      ${Inter.printOut('Zip Code:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'zipCode','errors')}">
                                    <input type="text" maxlength="6" size="6" id="zipCode" name="zipCode" value="${fieldValue(bean:employeeInstance,field:'zipCode')}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dob">
                                      ${Inter.printOut('Dob:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'dob','errors')}">
                                    <g:datePicker name="dob" value="${employeeInstance?.dob}" precision="day" ></g:datePicker>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="email">
                                      ${Inter.printOut('Email:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'email','errors')}">
                                    <input type="text" maxlength="50" id="email" name="email" value="${fieldValue(bean:employeeInstance,field:'email')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="hiredBy">
                                      ${Inter.printOut('Hired By:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'hiredBy','errors')}">
                                    <g:select optionKey="id" from="${session.access.getList('area')}" name="hiredBy.id" title="${Inter.printOut('employee_hiredBy_hover',session.language)}" value="${employeeInstance?.hiredBy?.id}" noSelection="['null':'']"></g:select>
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="title">
                                      ${Inter.printOut('Title:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'title','errors')}">
                                    <input type="text" maxlength="20" id="title" name="title" title="${Inter.printOut('employee_title_hover',session.language)}" value="${fieldValue(bean:employeeInstance,field:'title')}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="salary">
                                      ${Inter.printOut('Salary:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'salary','errors')}">
                                    <input type="text" id="salary" maxlength="8" size="8"  name="salary" value="${fieldValue(bean:employeeInstance,field:'salary')}" />SEK
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="percentageWork">
                                      ${Inter.printOut('Percentage Work:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'percentageWork','errors')}">
                                    <input type="text" id="percentageWork" size="5" maxlength="5" name="percentageWork" title="${Inter.printOut('employee_percentageWork_hover',session.language)}" value="${fieldValue(bean:employeeInstance,field:'percentageWork')}" />%
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="phoneNumber">
                                      ${Inter.printOut('Phone Number:',session.language)}
                                    </label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:employeeInstance,field:'phoneNumber','errors')}">
                                    <input type="text" maxlength="30" size="10" id="phoneNumber" name="phoneNumber" value="${fieldValue(bean:employeeInstance,field:'phoneNumber')}" />
                                </td>
                            </tr>

                        </tbody>
                    </table>
                  <!--added to test if it works-->
                   <input type="hidden" id="mode" name="mode" value="${session.mode}"/>
                </div>
                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="${Inter.printOut('Create',session.language)}" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>